﻿package com.woniuxy.util;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id = "2016101100662236";
	
	// 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDL/5wvCdyrr3An3zeRaNEEXco5IOJvgOUTjjmL7A2igMfk6JHBFMOO7bjQDxio3W6NAqsWbYyU78An3w+sB5rPBENxH9Cf6MpjTU5SatYkCZJUMJBzWNVPMqhWokqVyBDqu1TcwZx/Uk9C/j8CsnhZxLWkXBpHP+KHFXFc6t0un/ol7G4U9vk5q5/x8NmBSBK8+N4UQsgF6w7SqSt0tkEjf/LJa0pNRMHA3ZY63epVk2LvovRnAY8I+2nfkpuN2/bwtdyFq1wibYnk2hBv8s8kNmFF4KSBnoy3VjUXhODUCBtMz0rO9/6jO4O+XgriCTGjPclxwnhlAHAVDMOloz3rAgMBAAECggEAQg4Zn62c08byFScVUjNTgwtvoMICMELXalaiUal03MrAb2HTWGcFz7EwJ8bLoFpbIrPbfF6qp8teOErlQzoPKbtiry2zGySA7Fiq5MsNXgvvYu16yK7aG1P26F6Ssh9fQvK3zueuahfX7IRxGMl7aO3mNztPkwSfsEgENiciyaaVEIS4RUKTYDcf0pz+d5vho2c/07o4xj5vtA1p+9vmToybsN+3gJYekdx+6uZOA23qkgiQntZYuoLjLrk4YRqmzWNd7SnMnIY8Vv/B3mFDohSxVlHXtSoFhnQ7zIiKStNRMb4EzMiv3GKXm5Df+RKcJpqeTaJwYAXuhntXI7Sc2QKBgQD4e8sHaD2+VR5UzsPEXZbttiw5B+5iPTGPbq6RaLEpVZk3rswj4TK+t6OPxZWcui9WhrJfCUnZRSsvSammm7hxzmvyH4C6x10GGvGtnP2qC0yNeMlPBMIJtGhegFrHwYTh9yKrnyRJXKBhOsGebwEoP6QYsjbczzhH8LDywVt+TwKBgQDSK1VZYYV7X/SqVXWF5uZRUgRNk2qZuVdQMTCob3kU7YI9JJfiIHwh/cP5aaaISYQ75H4kGMl8HXMy24koviHtxb9WkPihNQGFf7dG62J24kL+8K0mhjztW5MhK4R99IPsZI7g8ozsdBeR9HvMIDI7cCMbbEMLqWS4/u1a2X+bpQKBgQC7mIpRj0t+FLkPggKej6HQ2YZNkEVS+awfA4rb0NRfxnYkad1JAU3UWsQrWRp49r+ibZLg2Rxd4jCWRODGHi6EDTnF1C7V1InQgCsRzcJczKcA773b4FW2CfP51KG0yc9O4cvVEhLNKBcVEMz4lgmjn1h+JJ3y2qc8+OQ+gehXVQKBgB74Ba6TATFJ1WqYByZA/OU0ua+YrleSiPwnE21uZ6Ae01chIkRO1xvHIe6Jk+F3O8X7iF7XTDE+wa/Xy6E2SxeXUPd3iztt7Rh31lDb9HliI88fNdR8aVPsb4Suveo1co8NzkP1WbCp9qMqLGfKwrwhbProfASm5FGiNuVxMS2FAoGBAPXSN/IxOrl3zJ1yM/y+WTJNDE8tej2kuYxEEXiXcbGpW/Utj/cw76WRfJLLwtXNZIH+LRdhGwJtim+gYKnQ/URi6/B39xiGWSqs0DGw3TCPivtMJnojl8kMpraywsRobditkTiRYlzjNBKwUNuNbj3f1qfOqnqpF6fgimkNLKVQ";
	
	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0XhLXXwYvbCPTKPsqdHJ3z2G4pMzIwFjuYhYK/HfMcpZfc7LZEZMTS5qzAEnmYJb+c4xPu+0oTDkiU2dQQn01RqEIeio/UNkL/1SMfVWYqlUirI/sl4EfUoYPI1nBY71p0sUVnt4HNwzCCU4zeV+bEvJQiVkCnLqM6K/yXO3v+qGlTKaza/DomDgSCZJW6ZneScs3J/ZkPxeisnO/4v0ISLE0o8StL4gGJmajbcU81NqShN+PrpyxwMxZV97HOkL6/gDjPNm0w4HI/wzXvUkegYlPsSNoKW5ErrAyPgQOdgVQTfXNWKHEQw+FoA7Wtik0eS8ZT7AI4ciPZGPNisfVwIDAQAB";

	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "http://2j552f0936.wicp.vip/pay/notify";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = "http://2j552f0936.wicp.vip/index.html";

	// 签名方式
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 支付宝网关
	public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";
	
	// 支付宝网关
	public static String log_path = "D:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

